-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Extend wrapped JS function coverage in core runtime types #12263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ame JSError to ThrownFromJavaScript - Introduced new methods to core JS runtime types to improve host interop - Renamed JSError to ThrownFromJavaScript for semantic clarity - Original name implied alignment with native JS Error, but the class represents any thrown JS object
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSNumber.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSString.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSString.java
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSSymbol.java
Outdated
Show resolved
Hide resolved
Thank you for signing the OCA. |
...racle.svm.webimage.jtt/src/com/oracle/svm/webimage/jtt/testdispatcher/JSAnnotationTests.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSNumber.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSNumber.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSNumber.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSNumber.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSSymbol.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSSymbol.java
Outdated
Show resolved
Hide resolved
web-image/src/com.oracle.svm.webimage.jtt/src/com/oracle/svm/webimage/jtt/api/JSSymbolTest.java
Outdated
Show resolved
Hide resolved
sdk/src/org.graalvm.webimage.api/src/org/graalvm/webimage/api/JSSymbol.java
Outdated
Show resolved
Hide resolved
web-image/src/com.oracle.svm.webimage.jtt/src/com/oracle/svm/webimage/jtt/api/JSSymbolTest.java
Show resolved
Hide resolved
|
||
@JS.Coerce | ||
@JS(value = "return String.fromCharCode(...codeUnits);") | ||
public static native JSString fromCharCode(int... codeUnits); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use use char... codeUnits
instead here? The function only accepts numbers from 0 to 65535 anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using int... matches JavaScript’s fromCharCode, which takes numbers, not characters. While char... would work for values ≤ 65535, it forces explicit casting for int values.
This pull request expands the set of host-accessible wrappers for internal JavaScript functions across key runtime types:
JSObject
,JSNumber
,JSString
,JSSymbol
, andJSValue
. These additions improve Java interop and simplify invocation of JavaScript behavior from host code.Additionally, the class
JSError
has been renamed toThrownFromJavaScript
to better reflect its actual role. The original name implied alignment with the native JavaScriptError
object, but the class more accurately represents any object thrown from JavaScript, regardless of its type.